<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 00:33:05
 * @LastEditTime: 2022-08-25 21:33:51
 * @LastEditors: CHINAKAIYUAN
 * @Description: 
 */

namespace App\Models;

use App\Traits\AutoCodeTrait;
use App\Traits\MaterialTrait;


class MpcReel extends BaseModel
    {
    use MaterialTrait;
    use AutoCodeTrait;
    public $timestamps = true;
    public $table = "sys_mpc_reel_struct";
    protected $guarded = [];
    protected $ACSign = 'MpcReelStruct';
    public function struct_new_storage()
        {
        return $this->hasMany(MpcReelNewstorage::class, "main_id");
        }
    public function struct_storage()
        {
        return $this->hasMany(MpcReelStorage::class, "main_id");
        }
    public function status()
        {
        return $this->belongsTo(Dic::class, "status_id", "key")->where(function ($q)
            {
            $q->where("code", 'status_with_finance');
            });
        }
    }
